<template>
    <div class="acceptance-registration-increase">

            <!-- 新增弹窗 -->
        <a-modal
        class="qualityFlow-increase-modal"
        :visible="visibleShow"
        :title="parameterData.fxglx+'--'+parameterData.fhjmc"
        :maskClosable="false"
        :closable="false"
        :destroyOnClose="true"
        :forceRender="true"
        width="100%"
        wrapClassName="full-modal"
        >
            <a-spin size="large" :spinning="modalSpinningPrice" :key="spinningKey">
                <a-spin size="large" :spinning="subLoading">
                    <div style="width: 98%; background-color: #fff;top: 10px;z-index: 99;padding: 10px;display: flex;justify-content: space-between;">
                        <div>
                            <a-button class="blue-btn" type="primary" @click="returnClick()" icon="rollback" >返回</a-button>
                            <a-button style="margin-left: 10px;" class="blue-btn" type="primary" @click="refreshClick()" icon="reload">刷新</a-button>
                        </div>
                        <div style="" v-if="viewFlag">
                            <a-button v-if="parameterData.fhjmc !== '申请'" class="red-btn" type="primary" @click="returnFlow()" icon="left-circle">退回</a-button>
                            <a-button class="blue-btn" type="primary" @click="preserveClick()" style="margin-left: 15px;" icon="save">保存</a-button>
                            <a-button :loading="subLoading" class="blue-btn" type="primary" @click="submitClick()" style="margin-left: 15px;" icon="check-circle">提交</a-button>
                        </div>
                    </div>
                    <!-- <div style="width: 100%;height: 60px;"></div> -->
                    <dealWithPromotePublicize v-if="parameterData.fxglx=='宣贯培训'" ref="dealWithRef" @refreshClick="refreshClick" :parameter="parameterData" :viewFlag="viewFlag" @successReturn="successReturn" @updatedSuccess="updatedSuccess" @loadingHandle="loadingHandle"/>
                    <dealWith v-else ref="dealWithRef" @refreshClick="refreshClick" :parameter="parameterData" :viewFlag="viewFlag" @successReturn="successReturn" @updatedSuccess="updatedSuccess" @loadingHandle="loadingHandle"/>
                </a-spin>
            </a-spin>
        </a-modal>

    </div>
</template>
<script>
import dealWith from './dealWith.vue'
import dealWithPromotePublicize from './dealWithPromotePublicize.vue'
import {innerChangeFlowJob} from './service/index'
import compSelector from '@/components/compSelector/compSelector'
export default {
    components:{
        dealWith,
        compSelector,
        dealWithPromotePublicize,
    },
    props:{
        addEditParameter:{
            type:[Array,Object],
            default: () => {},
            required:false
        },
        viewFlag: true
    },
    data(){
        return{
            typeSelect:'Select',
            visibleShow:false,
            confirmLoading:false,
            formState:{ksfl:''},
            formRequer:'',
            spinningKey:null,
            submittedSuccessfully:false,
            parameterData:{},
            nodeList: ['申请','科室复核','分管领导','质量负责人','中心领导','修订确认','修订审核','宣贯学习','宣贯效果评价','实施发布'],
            subLoading: false,
        }
    },
    computed: {
        modalSpinningPrice(){
            return this.$store.state.permission.modalSpinningPrice
        },
    },
    watch:{
        addEditParameter: {
            handler (newval, oldVal) {
                this.cancelLoading()
                //console.log('获取到了什么',newval)
                this.parameterData = newval
            },
            deep: true
        },

    },
    mounted(){
    },
    methods:{
        getData(row){
            this.parameterData =row
            this.$nextTick(()=>{
                //console.log('获取到了什么88',row)
                this.$refs.dealWithRef.getData(this.parameterData)
            })
        },
        cancelFalse(){
            this.cancelLoading()
        },
        updatedSuccess(){
            this.cancelLoading()
        },
        cancelLoading(){
            this.$store.dispatch('UpdateSpinningPrice', {key:true,stateKey:'modalSpinningPrice'})
        },
        returnClick(){//返回
            this.visibleShow = false
        },
        refreshClick(val){
            this.$emit('reviseClick',this.parameterData)
            this.spinningKey = Date.now()
            this.cancelLoading()
        },

        // 退回
        returnFlow(){
            if (this.parameterData.fhjmc === this.nodeList[0]){
                this.$refs.dealWithRef.returnFlow();
            }else {
                this.$refs.dealWithRef.returnFlow();
            }
        },

        //保存
        preserveClick(){
            this.$refs.dealWithRef.handlePreserve();

        },

        //提交
        submitClick(){
            this.$refs.dealWithRef.shandleSubmit();
        },
        successReturn(val){
            this.visibleShow = val
            this.$emit('successReturn')
        },
        //
        loadingHandle(val){
            //console.log('没进来loading吗？？？',val)
            this.subLoading = val
            //console.log('没进来loading吗---',this.subLoading)
        }
    }

}

</script>
<style lang="less">
/* .ant-form-item-label{
    font-weight: 600;
} */
.red-btn{
    border: 1px solid #ed5565 !important;
    background-color: #ed5565 !important;
}

 .ant-modal-title{
    font-weight: 600;
 }
 .ant-modal-header{
    background: #5ca3e5;
 }
 .ant-modal-footer .ant-btn-primary{
    border: 1px solid #5ca3e5 !important;
    background-color: #5ca3e5 !important;
    color: #fff !important;
 }
//  .qualityFlow-increase-modal .ant-modal-header{
//     display: none !important;
//  }
 .qualityFlow-increase-modal .ant-modal-body{
    padding: 5px;
 }
 .qualityFlow-increase-modal .ant-modal-footer{
    display: none !important;
 }
 .qualityFlow-increase-modal .ant-modal-content{
    height: 100vh;
    overflow: auto;
 }
 .full-modal {
  .ant-modal {
    max-width: 100%;
    top: 0;
    padding-bottom: 0;
    margin: 0;
  }
  .ant-modal-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: calc(100vh);
  }
  .ant-modal-body {
    flex: 1;
  }
}
</style>
